package com.blb.community.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;

import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import com.baomidou.mybatisplus.annotation.*;
import com.blb.community.converter.SexConverter;
import com.blb.community.converter.StatusConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户信息表
 * </p>
 *
 * @author 帅帅
 * @since 2022-07-02
 */
@Data
@TableName("sys_user")
@ApiModel(value = "SysUser对象", description = "用户信息表")
@EqualsAndHashCode
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER)
public class SysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("用户ID")
    @TableId(value = "user_id", type = IdType.AUTO)
    @ColumnWidth(15)
    @ExcelProperty("用户编号")
    private Integer userId;

    @ExcelProperty("部门编号")
    @ColumnWidth(15)
    @ApiModelProperty("部门ID")
    private Integer deptId;

    @ExcelProperty("用户账号")
    @ApiModelProperty("用户账号")
    @ColumnWidth(15)
    private String userName;

    @ExcelProperty("用户昵称")
    @ColumnWidth(15)
    @ApiModelProperty("用户昵称")
    private String nickName;

    @ColumnWidth(15)
    @ExcelProperty("用户类型")
    @ApiModelProperty("用户类型（00系统用户）")
    private String userType;

    @ColumnWidth(15)
    @ExcelProperty("用户邮箱")
    @ApiModelProperty("用户邮箱")
    private String email;
    @ColumnWidth(20)
    @ExcelProperty("手机号码")
    @ApiModelProperty("手机号码")
    private String phonenumber;

    @ColumnWidth(15)
    @ExcelProperty(value = "性别", converter = SexConverter.class)
    @ApiModelProperty("用户性别（0男 1女 2未知）")
    private Integer sex;

    @ExcelIgnore
    @ApiModelProperty("头像地址")
    private String avatar;

    @ColumnWidth(15)
    @ExcelIgnore
    @ApiModelProperty("密码")
    private String password;

    @ColumnWidth(15)
    @ExcelProperty(value = "帐号状态", converter = StatusConverter.class)
    @ApiModelProperty("帐号状态（0正常 1停用）")
    private String status;

    @ExcelIgnore
    @ApiModelProperty("删除标志（0代表存在 2代表删除）")
    @TableLogic
    private String delFlag;

    @ExcelIgnore
    @ApiModelProperty("最后登录IP")
    private String loginIp;

    @ExcelIgnore
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty("最后登录时间")
    private LocalDateTime loginDate;

    @ColumnWidth(15)
    @TableField(fill = FieldFill.INSERT)
    @ExcelProperty("创建者")
    @ApiModelProperty("创建者")
    private String createBy;

    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("更新者")
    private String updateBy;

    @ExcelIgnore
    @ApiModelProperty("更新时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @ColumnWidth(15)
    @ExcelProperty("备注")
    @ApiModelProperty("备注")
    private String remark;

}
